<?php
/**
 * Hols class Image_Lib_Util
 *
 * @author daantimmer
 *
 * @package Library
 * @subpackage Image
 */

/**
 * contains various functions used in the Image Library
 *
 * @author daantimmer
 */
class Image_Lib_Util{
	
	/**
	 * Converts $color to hsl-string
	 *
	 * @todo check to be removed
	 *
	 * @deprecated unfinished and not used no more
	 * @param Image_Lib_Color $color
	 * @return void
	 */
	public static function hsl2string(Image_Lib_Color $color){
		Image_Lib_Color::rgb2hsl($color->getRed(),$color->getGreen(), $color->getBlue(),$hsl = array());
	}
	
	/**
	 * Returns true if $val is between $min and $max ($min < $val < $max)
	 *
	 * @param float $min
	 * @param float $val
	 * @param float $max
	 * @return boolean
	 */
	public static function between($min,$val,$max){
		return ( $min < $val && $val < $max );
	}
	
	/**
	 * Returns true if $val is between or equal to $min and $max ($min <= $val <= $max)
	 *
	 * @param float $min
	 * @param float $val
	 * @param float $max
	 * @return boolean
	 */
	public static function equalBetween($min, $val, $max){
		return ( $min <= $val && $val <= $max );
	}
	
	/**
	 * returns a HSV array from $color
	 *
	 * @todo check to be removed
	 *
	 * @depreated was used before, but afaik not any more
	 * @param Image_Lib_Color $color
	 * @return array
	 */
	public static function getAsHSV(Image_Lib_Color $color){
		Image_Lib_Color::rgb2hsl($color->getRed(),$color->getGreen(), $color->getBlue(),$hsl = array());
		return $hsv;
	}
}